<?php
/**
* Api_View_Helper_JsHelper class for Boomerang Referral Network
*
* Api_View_Helper_JsHelper is the view helper class which is used to add JS file
* dynamically or on request based on module or switching module. To add CSS file 
* to the layout, File name must be exact to the name of module
* 
* @package      Api_View_Helper
* @copyright    Copyright (c) 2011-2012 Boomerang Referral Network
* @version      $Id: JsHelper.php v 1.0.0$
* @since        Class available since Release 1.0.0
* @author       Anindya Roy Chodhury <anindya23@gmail.com>
*/
class Api_View_Helper_JsHelper extends Zend_View_Helper_Abstract
{
    /**
     * Return JS file path 
     * 
     * @return array
     */
    public function jsHelper()
    {
        $request = Zend_Controller_Front::getInstance()->getRequest();
        $moduleName = $request->getModuleName();
        $fileUri = '/js/' . $moduleName . '.js';

        $this->view->headScript()->setFile($fileUri);
        return $this->view->headScript();
    }
}